package com.anasoft.os.s4j.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.junit.runner.notification.RunListener;

import com.anasoft.os.s4j.ErrorReportingListener;

/**
 * Error reporting configuration in relation to failed tests.
 * 
 * @see SeleniumSession
 * @see ErrorReportingListener
 * 
 * @author vojtech.szocs
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
@Inherited
public @interface ErrorReporting {

    /**
     * Is the error reporting enabled?
     */
    boolean enabled();

    /**
     * Directory into which output files will be generated by Selenium server.
     * <p>
     * <em>The value must always end with the path separator.</em>
     */
    String serverOutputDirectory() default "selenium/";

    /**
     * Directory into which output files will be generated by test runners.
     * <p>
     * <em>The value must always end with the path separator.</em>
     */
    String runnerOutputDirectory() default "selenium/";

    /**
     * If an exception occurs during error reporting {@link RunListener}
     * execution, it can't fall through because this would essentially disable
     * the listener for subsequent tests.
     * <p>
     * If set to <tt>true</tt>, all exceptions are silently ignored during
     * listener execution.
     * <p>
     * If set to <tt>false</tt>, an {@link Error} will be logged to the console
     * (this has no effect on JUnit assertion messages).
     */
    boolean swallowExceptions() default true;

    /**
     * Capture screenshots for failed tests?
     * <p>
     * Note that screenshots are physically stored by Selenium server.
     */
    boolean captureScreenshots() default true;

    /**
     * Retrieve recent Selenium server logs for failed tests?
     * <p>
     * Note that server logs are physically stored by test runners.
     */
    boolean retrieveLastRemoteControlLogs() default false;

}
